package xuliehualiu;

import java.io.*;

public class t1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
//        save();
        read2();
    }

    private static void read2() throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:\\study\\999.java拓展\\自己敲代码-git\\javaBase\\homeExtendDay14\\src\\main\\java\\xuliehualiu\\n.txt"));
        Object read = ois.readObject();
        System.out.println(read);
        ois.close();
    }

    private static void save() throws IOException {
        Student tkf = new Student("tkf", 123);
        ObjectOutputStream ous =   new ObjectOutputStream(new FileOutputStream("D:\\study\\999.java拓展\\自己敲代码-git\\javaBase\\homeExtendDay14\\src\\main\\java\\xuliehualiu\\n.txt"));
        ous.writeObject(tkf); // 使用writeObject，不是write
        ous.close();
    }
}
